package model

import (
	"manager/model/entity"

	"github.com/lib/pq"
)

// TransferRecodeCreateRequest 创建现场数据
type TransferRecodeCreateRequest struct {
	UserId int64 `json:"user_id"`

	BindPhones pq.StringArray `json:"bind_phones"`

	EbikeId int64 `json:"ebike_id"`

	Status int `json:"status"`

	UpdatedAt int64 `json:"updated_at"`
}

// TransferRecodeUpdateRequest 更新现场数据
type TransferRecodeUpdateRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	BindPhones *pq.StringArray `json:"bind_phones"`

	EbikeId *int64 `json:"ebike_id"`

	Status *int `json:"status"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// TransferRecodeListRequest 列表现场数据
type TransferRecodeListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	BindPhones *pq.StringArray `json:"bind_phones"`

	EbikeId *int64 `json:"ebike_id"`

	Status *int `json:"status"`

	UpdatedAt *int64 `json:"updated_at"`
}

// TransferRecodeListResponse 列表回包数据
type TransferRecodeListResponse struct {
	Total int                   `json:"total"`
	List  []*TransferRecodeInfo `json:"list"`
}

// TransferRecodeInfoRequest 列表现场数据
type TransferRecodeInfoRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	BindPhones *pq.StringArray `json:"bind_phones"`

	EbikeId *int64 `json:"ebike_id"`

	Status *int `json:"status"`

	UpdatedAt *int64 `json:"updated_at"`
}

// TransferRecodeInfo 详细数据
type TransferRecodeInfo struct {
	Id int64 `json:"id"`

	UserId int64 `json:"user_id"`

	BindPhones pq.StringArray `json:"bind_phones"`

	EbikeId int64 `json:"ebike_id"`

	Status int `json:"status"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// TransferRecodeDeleteRequest 删除现场数据
type TransferRecodeDeleteRequest struct {
	Id int64 `json:"id"`
}

// TransferRecodesEntityToDto entity数据转换
func TransferRecodesEntityToDto(transferRecodes []*entity.TransferRecode) []*TransferRecodeInfo {
	out := make([]*TransferRecodeInfo, 0, len(transferRecodes))
	for _, c := range transferRecodes {
		out = append(out, TransferRecodeEntityToDto(c))
	}
	return out
}

// TransferRecodeEntityToDto entity数据转换
func TransferRecodeEntityToDto(e *entity.TransferRecode) *TransferRecodeInfo {
	return &TransferRecodeInfo{

		Id: e.Id,

		UserId: e.UserId,

		BindPhones: e.BindPhones,

		EbikeId: e.EbikeId,

		Status: e.Status,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
